import Vue from 'vue'
import App from './App.vue'
import router from './router'
// 全局数据共享中心
import store from './store/index'
// 引入自定义函数方法
import fun from './components/common/myfunction'
// 字体图标
import './assets/iconfont.css'
// brand 面包屑导航组件
import Brand from './components/common/brand.vue'
// 引入请求中心文件
import Http from './index.js'
import imageUpload from './components/imageUpload/imageUpload.vue'
import ptUpload from './components/imageUpload/ptUpload.vue'
import muchUpload from './components/imageUpload/uploadMuch.vue'

import JsonExcel from 'vue-json-excel'

// UI框架
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// 导入树形控件
import VueCropper from 'vue-cropper'
import ZkTable from 'vue-table-with-tree-grid'
Vue.use(VueCropper)
Vue.component(ZkTable.name, ZkTable)
Vue.component('brand', Brand)
Vue.component('image-upload', imageUpload)
Vue.component('pt-upload', ptUpload)
Vue.component('much-upload', muchUpload)
Vue.component('downloadExcel', JsonExcel)
Vue.use(ElementUI)
Vue.config.productionTip = false

Vue.prototype.$http = Http
Vue.prototype.$regular = fun
// 过滤器 时间格式
Vue.filter('dateFrom', (e) => fun.momen(e))
// Vue.prototype.$fun = fun
Vue.prototype.$showLoading = (val) => { // 全局加载等待弹窗
  const loading = Vue.prototype.$loading({
    lock: true,
    text: '正在操作，请稍后...',
    spinner: 'el-icon-loading',
    background: 'rgba(0, 0, 0, 0.7)'
  })
  setTimeout(() => {
    loading.close()
  }, 4000)
  if (val === 'close') {
    loading.close()
  }
}
Vue.prototype.$operateTip = (title, msg, type) => {
  Vue.prototype.$notify({
    title: title || '成功',
    message: msg || '操作成功！',
    type: type || 'success',
    duration: 2000
  })
}
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
